Skip to content

Comments

rustc_query_impl: Use ControlFlow in visit_waiters instead of nested options#152582

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
petrochenkov:waitvisit
Feb 15, 2026
Merged

rustc_query_impl: Use ControlFlow in visit_waiters instead of nested options#152582
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
petrochenkov:waitvisit

Conversation

@petrochenkov
Copy link
Contributor

Noticed when reviewing #152229.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 13, 2026
@petrochenkov petrochenkov marked this pull request as ready for review February 13, 2026 16:14
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 13, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 13, 2026

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, query-system
  • compiler, query-system expanded to 68 candidates
  • Random selection from 17 candidates

@TaKO8Ki
Copy link
Member

TaKO8Ki commented Feb 14, 2026

Thanks. @bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 14, 2026

📌 Commit 2ee28ca has been approved by TaKO8Ki

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2026
rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #152622 (Update GCC subtree)
 - #145024 (Optimize indexing slices and strs with inclusive ranges)
 - #151365 (UnsafePinned: implement opsem effects of UnsafeUnpin)
 - #152381 (Do not require `'static` for obtaining reflection information.)
 - #143575 (Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s)
 - #152404 (tests: adapt align-offset.rs for InstCombine improvements in LLVM 23)
 - #152582 (rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options)
rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #152622 (Update GCC subtree)
 - #145024 (Optimize indexing slices and strs with inclusive ranges)
 - #151365 (UnsafePinned: implement opsem effects of UnsafeUnpin)
 - #152381 (Do not require `'static` for obtaining reflection information.)
 - #143575 (Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s)
 - #152404 (tests: adapt align-offset.rs for InstCombine improvements in LLVM 23)
 - #152582 (rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options)
@rust-bors rust-bors bot merged commit 7c36d15 into rust-lang:main Feb 15, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Feb 15, 2026
Rollup merge of #152582 - petrochenkov:waitvisit, r=TaKO8Ki

rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options

Noticed when reviewing #152229.
@rustbot rustbot added this to the 1.95.0 milestone Feb 15, 2026
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 15, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#152622 (Update GCC subtree)
 - rust-lang/rust#145024 (Optimize indexing slices and strs with inclusive ranges)
 - rust-lang/rust#151365 (UnsafePinned: implement opsem effects of UnsafeUnpin)
 - rust-lang/rust#152381 (Do not require `'static` for obtaining reflection information.)
 - rust-lang/rust#143575 (Remove named lifetimes in some `PartialOrd` & `PartialEq` `impl`s)
 - rust-lang/rust#152404 (tests: adapt align-offset.rs for InstCombine improvements in LLVM 23)
 - rust-lang/rust#152582 (rustc_query_impl: Use `ControlFlow` in `visit_waiters` instead of nested options)
@JonathanBrouwer
Copy link
Contributor

@rust-timer build 55efe98

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (55efe98): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.5%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -1.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.2% [3.2%, 3.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.4% [-6.4%, -6.4%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [1.8%, 2.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 483.617s -> 480.574s (-0.63%)
Artifact size: 397.94 MiB -> 397.95 MiB (0.00%)

query: QueryJobId,
visited: &mut FxHashSet<QueryJobId>,
) -> bool {
) -> ControlFlow<Option<Waiter>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this changed? connected_to_root(..).is_break() reads quite off to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connected_to_root is a visitor, so I gave it the visitor signature.
I kept the bool initially, but it was uglier.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it even return?

Copy link
Contributor Author

@petrochenkov petrochenkov Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ControlFlow::Continue(()) (not connected, continue searching) or ControlFlow::Break(_) (connected, stop searching).
(visit_waiters can actually put a some (unused) waiter into Break, or it can be None, doesn't matter.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants